﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace Gmantis.Controls.Extended
{
    public class BoolConverter : IValueConverter
    {
        internal static object Convert(object value, Type targetType)
        {
            if (targetType == typeof(object))
            {
                return System.Convert.ToBoolean(value);
            }

            return value;
        }

        object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Convert(value, targetType);
        }

        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Convert(value, targetType);
        }
    }
}
